package model.map;

import main.Log;
import utilities.*;

public class NoLimitHexLocationProjection extends LocationProjection implements Archiveable {

	/**
     * Returns the location that a movement of Direction will result in, based on the passed in location
     * @return The location that the movement will result in.
     */
    public Location projectLocation(Location location, Direction direction)
    {
            switch(direction)
            {
                    case SW: return new Location(location.getX() + 1, location.getY());
                    case S: return new Location(location.getX() + 1, location.getY() + 1);
                    case SE: return new Location(location.getX(), location.getY() + 1);
                    case NW: return new Location(location.getX(), location.getY() - 1);
                    case N: return new Location(location.getX() - 1, location.getY() - 1);
                    case NE: return new Location(location.getX() - 1, location.getY());
                    case W: return new Location(location.getX() + 1, location.getY() - 1);
                    case E: return new Location(location.getX() - 1, location.getY() + 1);
                    default: Log.out(Log.MODEL, "HexLocationProjection: returned NULL?"); return null;
            }
    }
    
    /**
     * Returns the location that a movement of length tiles, in a Direction will result in, based on the passed in location
     * @return The location that the movement will result in.
     */
    public Location projectLocation(Location location, Direction direction, int length)
    {
            switch(direction)
            {
                    case SW: return new Location(location.getX() + length, location.getY());
                    case S: return new Location(location.getX()  + length, location.getY()  + length);
                    case SE: return new Location(location.getX(), location.getY() + length);
                    case NW: return new Location(location.getX(), location.getY() - length);
                    case N: return new Location(location.getX() - length, location.getY() - length);
                    case NE: return new Location(location.getX() - length, location.getY());
                    case W: return new Location(location.getX() + length, location.getY() - length);
                    case E: return new Location(location.getX() - length, location.getY() + length);
                    default: Log.out(Log.MODEL, "HexLocationProjection: returned NULL?"); return null;
            }
    }
    
	public Archive save() {
		Archive archive = super.save();
		
		return archive;
	}
	
	public void load(Archive archive) {
		super.load(archive);
	}
    
}
